package router

import (
	"gitee.com/git_public/vfaith/toolkit/swag/embed"
	httpSwagger "github.com/swaggo/http-swagger"
	"net/http"
)

func init() {
	// 配置Swagger路由
	http.Handle("/swagger/", httpSwagger.WrapHandler)

	//http.Handle("/", handle.AddPrefix("knife/", http.FileServerFS(embed.FsKnifeWeb)))
	http.Handle("/knife/", http.FileServerFS(embed.FsKnifeWeb))

	// 简单的路由
	http.HandleFunc("/swagger/SwagExample", SwagExample)
}

// SwagExample
// @Summary 这是一个Swag接口例子.
// @Description Get a simple ping response
// @Tags Swag
// @Accept  json
// @Produce  json
// @Success 200 {object} map[string]string
// @Router /swagger/SwagExample [get]
func SwagExample(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(http.StatusOK)
	w.Write([]byte(`{"message": "请求成功"}`))
}
